// --------------------------------------查看详情功能及处理回显功能--------------------------------------------------------------
$.get("/typelist")
    .done(list=>{
        list.forEach(function (Sertype) {
            var opt= $("<option/>");
            opt.val(Sertype.serviceId);
            opt.text(Sertype.serviceNames);
            opt.appendTo("#See [name=leixing]");
        })
    });
$.get("/staYglist")
    .done(list=>{
        list.forEach(function (stayg) {
            var opt= $("<option/>");
            opt.val(stayg.empId);
            opt.text(stayg.empName);
            opt.appendTo("#fenpei [name=processedMan]");
        })
    });
function actionFormatter(){
    var del=`<button class="aaa btn btn-danger "><i class="glyphicon glyphicon-eye-open"></i>查看</button> `;
    return del;
}
var actionEvents = {
    "click .aaa": function (a, b, row) {
        $("#See [name=name]").html(row.serviceName);
        $("#See [name=kehu]").html(row.customer.name);
        $("#See [name=leixing]").html(row.servicetype.serviceNames);
        $("#See [name=phone]").html(row.customer.cellphone);
        $("#See [name=neirong]").html(row.serviceContent);
        $("#See [name=beizhu]").html(row.note);
        $("#See").dialog("show");

    }
}
$("#See").dialog({
    title:"查看服务详情",

})

// -----------------------------------------以下是条件查询---------------------------------------------------
function chaxun() {
    var formParams=$("#queryForm").serialize();
    var obj=Qs.parse(formParams);
    $("#serTb").bootstrapTable("refresh",{query:obj});

}
// -----------------------------以下是条件查询绑定状态和类型下拉框的值-------------------------------------------------
$.get("/typelist")
    .done(list=>{
        list.forEach(function (Sertype) {
            var opt= $("<option/>");
            opt.val(Sertype.serviceId);
            opt.text(Sertype.serviceNames);
            opt.appendTo("#queryForm [name=fuwuid]");
        })
    });
$.get("/startlist")
    .done(list=>{
        list.forEach(function (start) {
            var opt= $("<option/>");
            opt.val(start.fuwuid);
            opt.text(start.fuwuleixing);
            opt.appendTo("#queryForm [name=serviceId]");
        })
    });
// -----------------------------以下是归档功能-------------------------------------------------
function guidang() {
    var arr=$("#serTb").bootstrapTable("getSelections");
    if(arr.length==0){
        swal({
            type:"warning",
            title:"信息提示！！",
            text:"请选择一项待归档！",
            confirmButtonText: "确定"
        });
        return;
    }
    var ids=arr.map(Service=>{
        return "ids="+Service.serviceId
    }).join("&");
    $.get("FanKui?"+ids,msg=>{
        toastr.warning(msg);
        $("#serTb").bootstrapTable("refresh");
    })
}